// var IP = 'http://192.168.102.53:5005';

var toId, toType;
$(function () {

    function GetRequest() { // 调用url后的参数
        var url = window.location.search;
        var Request = new Object();
        if (url.indexOf("?") != -1) {
            var str = url.substr(1);
            strs = str.split("&");
            for (var i = 0; i < strs.length; i++) {
                Request[strs[i].split("=")[0]] = (strs[i].split("=")[1]);
            }
        }
        toId = Request["id"] * 1;
        toType = Request["type"] * 1;
        console.log(toId, toType);
    }
    GetRequest();

    $.ajax({
        type: "get",
        // url: IP + "/find-detail",
        url: "/find-detail",
        dataType: "json",
        data: {
            id: toId,
            type: toType
        },
        success: function (data) {
            cutNav(toType);
            showList(data,toType);
            cutDePage();
        },
        error: function (XMLHttpRequest, textStatus, errorThrown) {
            console.log('请求失败!');
        }
    })

    // 遍历详情信息
    function showList(data,type) {
        console.log(data)
        $('#de_conUlBox').html("");
        var de_conUlBox = "";
        if(type ==1){
            // oneEvaBasicInfo
            de_conUlBox += '<ul class="de_conUl fixed de_ulShow"><div class="de_conTitle"><span>基本信息</span></div>';
            de_conUlBox += '<li><div class="de_name">手术角色：</div><div class="de_txt">'+data.oneEvaBasicInfo.parm1+'</div></li>';
            de_conUlBox += '<li><div class="de_name">手术时间：</div><div class="de_txt">'+data.oneEvaBasicInfo.parm2+'</div></li>';
            de_conUlBox += '<li><div class="de_name">手术名称：</div><div class="de_txt">'+data.oneEvaBasicInfo.parm3+'</div></li>';
            de_conUlBox += '<li><div class="de_name">患者病历号：</div><div class="de_txt">'+data.oneEvaBasicInfo.parm4+'</div></li>';
            de_conUlBox += '<li><div class="de_name">主机型号：</div><div class="de_txt">'+data.oneEvaBasicInfo.parm5+'</div></li>';
            de_conUlBox += '<li><div class="de_name">镜头型号：</div><div class="de_txt">'+data.oneEvaBasicInfo.parm6+'</div></li>';
            de_conUlBox += '<li><div class="de_name">设备使用年限：</div><div class="de_txt">'+data.oneEvaBasicInfo.parm7+'</div></li>';
            de_conUlBox += '</ul>';
        }
        if(type ==2 || type==3 || type==4){
            // oneEvaBasicInfo
            de_conUlBox += '<ul class="de_conUl fixed de_ulShow"><div class="de_conTitle"><span>基本信息</span></div>';
            de_conUlBox += '<li><div class="de_name">手术角色：</div><div class="de_txt">'+data.oneEvaBasicInfoHard.parm1+'</div></li>';
            de_conUlBox += '<li><div class="de_name">手术时间：</div><div class="de_txt">'+data.oneEvaBasicInfoHard.parm2+'</div></li>';
            de_conUlBox += '<li><div class="de_name">手术名称：</div><div class="de_txt">'+data.oneEvaBasicInfoHard.parm3+'</div></li>';
            de_conUlBox += '<li><div class="de_name">患者病历号：</div><div class="de_txt">'+data.oneEvaBasicInfoHard.parm4+'</div></li>';
            de_conUlBox += '<li><div class="de_name">主机型号：</div><div class="de_txt">'+data.oneEvaBasicInfoHard.parm5+'</div></li>';
            de_conUlBox += '<li><div class="de_name">镜头型号：</div><div class="de_txt">'+data.oneEvaBasicInfoHard.parm6+'</div></li>';
            de_conUlBox += '<li><div class="de_name">设备使用年限：</div><div class="de_txt">'+data.oneEvaBasicInfoHard.parm7+'</div></li>';
            de_conUlBox += '</ul>';
        }
        if(type == 1){
            // oneVisionRelated
            de_conUlBox += '<ul class="de_conUl fixed"><div class="de_conTitle"><span>基本信息</span></div>';
            de_conUlBox += '<li><div class="de_name">视野：</div><div class="de_txt">'+data.oneVisionRelated.parm1+'</div></li>';
            de_conUlBox += '<li><div class="de_name">清晰度：</div><div class="de_txt">'+data.oneVisionRelated.parm2+'</div></li>';
            de_conUlBox += '<li><div class="de_name">成像稳定性：</div><div class="de_txt">'+data.oneVisionRelated.parm3+'</div></li>';
            de_conUlBox += '<li><div class="de_name">景深：</div><div class="de_txt">'+data.oneVisionRelated.parm4+'</div></li>';
            de_conUlBox += '<li><div class="de_name">分辨能力：</div><div class="de_txt">'+data.oneVisionRelated.parm5+'</div></li>';
            de_conUlBox += '<li><div class="de_name">立体感：</div><div class="de_txt">'+data.oneVisionRelated.parm6+'</div></li>';
            de_conUlBox += '<li><div class="de_name">镜头抗模糊能力：</div><div class="de_txt">'+data.oneVisionRelated.parm7+'</div></li>';
            de_conUlBox += '<li><div class="de_name">抗反光能力：</div><div class="de_txt">'+data.oneVisionRelated.parm8+'</div></li>';
            de_conUlBox += '<li><div class="de_name">图像/色彩保真性：</div><div class="de_txt">'+data.oneVisionRelated.parm9+'</div></li>';
            de_conUlBox += '<li><div class="de_name">图像总体印象：</div><div class="de_txt">'+data.oneVisionRelated.parm10+'</div></li>';
            de_conUlBox += '</ul>';
            // oneOperRelated
            de_conUlBox += '<ul class="de_conUl fixed"><div class="de_conTitle"><span>基本信息</span></div>';
            de_conUlBox += '<li><div class="de_name">镜头擦拭效果：</div><div class="de_txt">'+data.oneOperRelated.parm1+'</div></li>';
            de_conUlBox += '<li><div class="de_name">镜头擦拭便利性：</div><div class="de_txt">'+data.oneOperRelated.parm2+'</div></li>';
            de_conUlBox += '<li><div class="de_name">冲洗吸引效果：</div><div class="de_txt">'+data.oneOperRelated.parm3+'</div></li>';
            de_conUlBox += '<li><div class="de_name">操作孔道通畅性：</div><div class="de_txt">'+data.oneOperRelated.parm4+'</div></li>';
            de_conUlBox += '<li><div class="de_name">操作精细程度：</div><div class="de_txt">'+data.oneOperRelated.parm5+'</div></li>';
            de_conUlBox += '<li><div class="de_name">目标部位显露能力：</div><div class="de_txt">'+data.oneOperRelated.parm6+'</div></li>';
            de_conUlBox += '<li><div class="de_name">目标部位操作便利性：</div><div class="de_txt">'+data.oneOperRelated.parm7+'</div></li>';
            de_conUlBox += '<li><div class="de_name">操作性总体印象：</div><div class="de_txt">'+data.oneOperRelated.parm8+'</div></li>';
            de_conUlBox += '<li><div class="de_name">关键手术步骤耗费时间：</div><div class="de_txt">'+data.oneOperRelated.parm9+'</div></li>';
            de_conUlBox += '<li><div class="de_name">并发症：</div><div class="de_txt">'+data.oneOperRelated.parm10+'</div></li>';
            de_conUlBox += '<li><div class="de_name">总操作时间：</div><div class="de_txt">'+data.oneOperRelated.parm11+'</div></li>';
            de_conUlBox += '</ul>';
            // oneDiscomfort
            de_conUlBox += '<ul class="de_conUl fixed"><div class="de_conTitle"><span>基本信息</span></div>';
            de_conUlBox += '<li><div class="de_name">视疲劳：</div><div class="de_txt">'+data.oneDiscomfort.parm1+'</div></li>';
            de_conUlBox += '<li><div class="de_name">躯体疲劳：</div><div class="de_txt">'+data.oneDiscomfort.parm2+'</div></li>';
            de_conUlBox += '</ul>';
        }
        if(type == 2){
            // oneVisionRelatedHard
            de_conUlBox += '<ul class="de_conUl fixed"><div class="de_conTitle"><span>基本信息</span></div>';
            de_conUlBox += '<li><div class="de_name">视野：</div><div class="de_txt">'+data.oneVisionRelatedHard.parm1+'</div></li>';
            de_conUlBox += '<li><div class="de_name">清晰度：</div><div class="de_txt">'+data.oneVisionRelatedHard.parm2+'</div></li>';
            de_conUlBox += '<li><div class="de_name">成像稳定性：</div><div class="de_txt">'+data.oneVisionRelatedHard.parm3+'</div></li>';
            de_conUlBox += '<li><div class="de_name">景深：</div><div class="de_txt">'+data.oneVisionRelatedHard.parm4+'</div></li>';
            de_conUlBox += '<li><div class="de_name">分辨能力：</div><div class="de_txt">'+data.oneVisionRelatedHard.parm5+'</div></li>';
            de_conUlBox += '<li><div class="de_name">对比度：</div><div class="de_txt">'+data.oneVisionRelatedHard.parm6+'</div></li>';
            de_conUlBox += '<li><div class="de_name">立体感：</div><div class="de_txt">'+data.oneVisionRelatedHard.parm7+'</div></li>';
            de_conUlBox += '<li><div class="de_name">镜头抗雾/烟能力：</div><div class="de_txt">'+data.oneVisionRelatedHard.parm8+'</div></li>';
            de_conUlBox += '<li><div class="de_name">抗反光能力：</div><div class="de_txt">'+data.oneVisionRelatedHard.parm9+'</div></li>';
            de_conUlBox += '<li><div class="de_name">图像保真性：</div><div class="de_txt">'+data.oneVisionRelatedHard.parm10+'</div></li>';
            de_conUlBox += '<li><div class="de_name">图像保真性：</div><div class="de_txt">'+data.oneVisionRelatedHard.parm11+'</div></li>';
            de_conUlBox += '<li><div class="de_name">变焦能力：</div><div class="de_txt">'+data.oneVisionRelatedHard.parm12+'</div></li>';
            de_conUlBox += '</ul>';
            // oneOperRelatedHard
            de_conUlBox += '<ul class="de_conUl fixed"><div class="de_conTitle"><span>基本信息</span></div>';
            de_conUlBox += '<li><div class="de_name">关键手术步骤耗费时间：</div><div class="de_txt">'+data.oneOperRelatedHard.parm1+'</div></li>';
            de_conUlBox += '<li><div class="de_name">关键手术步骤发生错误次数：</div><div class="de_txt">'+data.oneOperRelatedHard.parm2+'</div></li>';
            de_conUlBox += '<li><div class="de_name">并发症：</div><div class="de_txt">'+data.oneOperRelatedHard.parm3+'</div></li>';
            de_conUlBox += '<li><div class="de_name">总操作时间：</div><div class="de_txt">'+data.oneOperRelatedHard.parm4+'</div></li>';
            de_conUlBox += '<li><div class="de_name">中转开放：</div><div class="de_txt">'+data.oneOperRelatedHard.parm5+'</div></li>';
            de_conUlBox += '</ul>';
            // oneDiscomfortHard
            de_conUlBox += '<ul class="de_conUl fixed"><div class="de_conTitle"><span>基本信息</span></div>';
            de_conUlBox += '<li><div class="de_name">视疲劳：</div><div class="de_txt">'+data.oneDiscomfortHard.parm1+'</div></li>';
            de_conUlBox += '<li><div class="de_name">躯体疲劳：</div><div class="de_txt">'+data.oneDiscomfortHard.parm2+'</div></li>';
            de_conUlBox += '</ul>';
        }
        if(type == 3){
            // twoDeviceRelated
            de_conUlBox += '<ul class="de_conUl fixed"><div class="de_conTitle"><span>基本信息</span></div>';
            de_conUlBox += '<li><div class="de_name">交互界面：</div><div class="de_txt">'+data.twoDeviceRelated.parm1+'</div></li>';
            de_conUlBox += '<li><div class="de_name">镜柄外形：</div><div class="de_txt">'+data.twoDeviceRelated.parm2+'</div></li>';
            de_conUlBox += '<li><div class="de_name">按钮误触：</div><div class="de_txt">'+data.twoDeviceRelated.parm3+'</div></li>';
            de_conUlBox += '<li><div class="de_name">按钮盲操作：</div><div class="de_txt">'+data.twoDeviceRelated.parm4+'</div></li>';
            de_conUlBox += '<li><div class="de_name">镜头方向调节时阻尼大小：</div><div class="de_txt">'+data.twoDeviceRelated.parm5+'</div></li>';
            de_conUlBox += '<li><div class="de_name">镜头方向固定时阻尼大小：</div><div class="de_txt">'+data.twoDeviceRelated.parm6+'</div></li>';
            de_conUlBox += '<li><div class="de_name">镜柄重量：</div><div class="de_txt">'+data.twoDeviceRelated.parm7+'</div></li>';
            de_conUlBox += '<li><div class="de_name">光纤长度：</div><div class="de_txt">'+data.twoDeviceRelated.parm8+'</div></li>';
            de_conUlBox += '<li><div class="de_name">内窥镜长度：</div><div class="de_txt">'+data.twoDeviceRelated.parm9+'</div></li>';
            de_conUlBox += '<li><div class="de_name">设备可扩展性：</div><div class="de_txt">'+data.twoDeviceRelated.parm10+'</div></li>';
            de_conUlBox += '<li><div class="de_name">硬度 ：</div><div class="de_txt">'+data.twoDeviceRelated.parm11+'</div></li>';
            de_conUlBox += '<li><div class="de_name">电子染色：</div><div class="de_txt">'+data.twoDeviceRelated.parm12+'</div></li>';
            de_conUlBox += '<li><div class="de_name">副送水功能：</div><div class="de_txt">'+data.twoDeviceRelated.parm12+'</div></li>';
            de_conUlBox += '</ul>';
            // oneOperRelated
            de_conUlBox += '<ul class="de_conUl fixed"><div class="de_conTitle"><span>基本信息</span></div>';
            de_conUlBox += '<li><div class="de_name">高清录像：</div><div class="de_txt">'+data.twoImgRelated.parm1+'</div></li>';
            de_conUlBox += '<li><div class="de_name">缩放功能：</div><div class="de_txt">'+data.twoImgRelated.parm2+'</div></li>';
            de_conUlBox += '<li><div class="de_name">景深：</div><div class="de_txt">'+data.twoImgRelated.parm3+'</div></li>';
            de_conUlBox += '<li><div class="de_name">自动变焦：</div><div class="de_txt">'+data.twoImgRelated.parm4+'</div></li>';
            de_conUlBox += '<li><div class="de_name">高清显示：</div><div class="de_txt">'+data.twoImgRelated.parm5+'</div></li>';
            de_conUlBox += '</ul>';
            // oneDiscomfort
            de_conUlBox += '<ul class="de_conUl fixed"><div class="de_conTitle"><span>基本信息</span></div>';
            de_conUlBox += '<li><div class="de_name">弯曲性能：</div><div class="de_txt">'+data.twoOperRelated.parm1+'</div></li>';
            de_conUlBox += '</ul>';
            // 
            de_conUlBox += '<ul class="de_conUl fixed"><div class="de_conTitle"><span>基本信息</span></div>';
            de_conUlBox += '<li><div class="de_name">总体印象分：</div><div class="de_txt">'+data.twoGenImpre.parm1+'</div></li>';
            de_conUlBox += '</ul>';
        }
        if(type == 4){
            // twoDeviceRelatedHard
            de_conUlBox += '<ul class="de_conUl fixed"><div class="de_conTitle"><span>基本信息</span></div>';
            de_conUlBox += '<li><div class="de_name">交互界面：</div><div class="de_txt">'+data.twoDeviceRelatedHard.parm1+'</div></li>';
            de_conUlBox += '<li><div class="de_name">镜柄外形：</div><div class="de_txt">'+data.twoDeviceRelatedHard.parm2+'</div></li>';
            de_conUlBox += '<li><div class="de_name">按钮误触：</div><div class="de_txt">'+data.twoDeviceRelatedHard.parm3+'</div></li>';
            de_conUlBox += '<li><div class="de_name">按钮盲操作：</div><div class="de_txt">'+data.twoDeviceRelatedHard.parm4+'</div></li>';
            de_conUlBox += '<li><div class="de_name">镜头方向调节时阻尼大小：</div><div class="de_txt">'+data.twoDeviceRelatedHard.parm5+'</div></li>';
            de_conUlBox += '<li><div class="de_name">镜头方向固定时阻尼大小：</div><div class="de_txt">'+data.twoDeviceRelatedHard.parm6+'</div></li>';
            de_conUlBox += '<li><div class="de_name">光纤长度：</div><div class="de_txt">'+data.twoDeviceRelatedHard.parm7+'</div></li>';
            de_conUlBox += '<li><div class="de_name">镜柄重量：</div><div class="de_txt">'+data.twoDeviceRelatedHard.parm8+'</div></li>';
            de_conUlBox += '<li><div class="de_name">内窥镜长度：</div><div class="de_txt">'+data.twoDeviceRelatedHard.parm9+'</div></li>';
            de_conUlBox += '<li><div class="de_name">发热程度：</div><div class="de_txt">'+data.twoDeviceRelatedHard.parm10+'</div></li>';
            de_conUlBox += '</ul>';
            // twoImgRelated
            de_conUlBox += '<ul class="de_conUl fixed"><div class="de_conTitle"><span>基本信息</span></div>';
            de_conUlBox += '<li><div class="de_name">缩放功能：</div><div class="de_txt">'+data.twoImgRelated.parm1+'</div></li>';
            de_conUlBox += '<li><div class="de_name">高清显示及录像功能：</div><div class="de_txt">'+data.twoImgRelated.parm2+'</div></li>';
            de_conUlBox += '<li><div class="de_name">景深：</div><div class="de_txt">'+data.twoImgRelated.parm3+'</div></li>';
            de_conUlBox += '<li><div class="de_name">自动变焦：</div><div class="de_txt">'+data.twoImgRelated.parm4+'</div></li>';
            de_conUlBox += '<li><div class="de_name">镜头抗污/雾功能：</div><div class="de_txt">'+data.twoImgRelated.parm5+'</div></li>';
            de_conUlBox += '</ul>';
            // twoGenImpre
            de_conUlBox += '<ul class="de_conUl fixed"><div class="de_conTitle"><span>基本信息</span></div>';
            de_conUlBox += '<li><div class="de_name">总体印象分：</div><div class="de_txt">'+data.twoGenImpre.parm1+'</div></li>';
            de_conUlBox += '</ul>';
        }
        $('#de_conUlBox').html(de_conUlBox);
    }

    // 选项卡
    function cutNav(type) {
        if (type == 1) { //课题1-软镜
            $('.de_title').text('课题1-软镜')
            $('#de_conNav').html("");
            var de_conNav = '';
            de_conNav += '<div class="de_conNavList de_active">基础信息</div>';
            de_conNav += '<div class="de_conNavList ">视觉相关</div>';
            de_conNav += '<div class="de_conNavList ">操作相关</div>';
            de_conNav += '<div class="de_conNavList ">不适感</div>';
            $('#de_conNav').html(de_conNav);
        }
        if (type == 2) { //课题1-硬镜
            $('.de_title').text('课题1-硬镜')
            $('#de_conNav').html("");
            var de_conNav = '';
            de_conNav += '<div class="de_conNavList de_active">基础信息</div>';
            de_conNav += '<div class="de_conNavList ">视觉相关</div>';
            de_conNav += '<div class="de_conNavList ">操作相关</div>';
            de_conNav += '<div class="de_conNavList ">不适感</div>';
            $('#de_conNav').html(de_conNav);
        }
        if (type == 3) { //课题2-软镜
            $('.de_title').text('课题2-软镜')
            $('#de_conNav').html("");
            var de_conNav = '';
            de_conNav += '<div class="de_conNavList de_active">基础信息</div>';
            de_conNav += '<div class="de_conNavList ">设备相关</div>';
            de_conNav += '<div class="de_conNavList ">图像相关</div>';
            de_conNav += '<div class="de_conNavList ">操作相关</div>';
            de_conNav += '<div class="de_conNavList ">总体印象</div>';
            $('#de_conNav').html(de_conNav);
        }
        if (type == 4) { //课题2-硬镜
            $('.de_title').text('课题2-硬镜')
            $('#de_conNav').html("");
            var de_conNav = '';
            de_conNav += '<div class="de_conNavList de_active">基础信息</div>';
            de_conNav += '<div class="de_conNavList ">设备相关</div>';
            de_conNav += '<div class="de_conNavList ">图像相关</div>';
            de_conNav += '<div class="de_conNavList ">总体印象</div>';
            $('#de_conNav').html(de_conNav);
        }
    }

    function cutDePage() {
        $('#de_conNav .de_conNavList').click(function () {
            var deIndex = $(this).index();
            // console.log(deIndex);
            $(this).addClass('de_active').siblings().removeClass('de_active');
            $('.de_conUl').eq(deIndex).addClass('de_ulShow').siblings().removeClass('de_ulShow');
        })
    }
})